<?php
header("content-type:text/html;charset=utf-8");
include "../../public/config/config.php";
include("../../public/include/page.class.php");
$obj=new page($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd,$cfg_dbname,$cfg_dbchar);
$type=$_REQUEST['type'];
$keyword=$_REQUEST['keyword'];
$arr=$obj->listData("pay_zfb_sx",15,$type,$keyword);
$sel_arr[$type]="selected";
$pay_status = [
	"WAIT_BUYER_PAY" => "交易创建，等待买家付款",
	"TRADE_CLOSED" => "未付款交易超时关闭",
	"TRADE_SUCCESS" => "交易支付成功",
	"TRADE_FINISHED" => "交易结束，不可退款"
];

//echo "<pre>";
//print_r($arr);
//print_r($count_arr);
//print_r($see_call);
//echo "</pre>";
?>
<html lang="zh-CN">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
	<title>查看沙箱支付信息-- <?php echo $cfg_indexname;?></title>
	
	<!-- Bootstrap -->
	<link href="/public/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="/public/css/main.css"/>
	<link rel="stylesheet" type="text/css" href="common.css"/>
	
	<!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
	<!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
	<!--[if lt IE 9]>
	<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
	<![endif]-->
</head>
<body class="bg_liter">
<div class="big_div">
	<h3 class="bg-primary h3_title">沙箱支付明细</h3>
	<form action="see_pay_info.php" method="post">
		<select class="form-control w150 in_bl" name="type">
			<option <?php echo $sel_arr['subject']?> value="subject">订单标题</option>
			<option <?php echo $sel_arr['id']?> value="id">ID号</option>
			<option <?php echo $sel_arr['gmt_create']?> value="gmt_create">交易创建时间</option>
			<option <?php echo $sel_arr['out_trade_no']?> value="out_trade_no">商户订单号</option>
			<option <?php echo $sel_arr['total_amount']?> value="total_amount">订单金额</option>
			<option <?php echo $sel_arr['receipt_amount']?> value="receipt_amount">实收金额</option>
			<option <?php echo $sel_arr['body']?> value="body">商品描述</option>
		</select>
		关键字：<input type="text" class="form-control w200 in_bl" name="keyword" value="<?php echo $keyword;?>" />
		<input type="submit" class="btn btn-info" value="搜索"/>
	</form><br />
	<table class="table table-hover bg-info" border="2" cellspacing="" cellpadding="">
		<tr>
			<th>编号</th>
			<th>ID号</th>
			<th>订单标题</th>
			<th>交易状态</th>
			<th>交易创建时间</th>
			<th>商户订单号</th>
			<th>订单金额</th>
			<th>实收金额</th>
			<th>商品描述</th>
		</tr>

<?php
foreach($arr as $v){
	$i++;
?>			
		<tr>
			<td><?php echo $i;?></td>
			<td><?php echo $v['id'];?></td>
			<td><?php echo $v['subject'];?></td>
			<td><?php echo $pay_status[$v['trade_status']];?></td>
			<td><?php echo $v['gmt_create'];?></td>
			<td><?php echo $v['out_trade_no'];?></td>				
			<td><?php echo $v['total_amount'];?></td>
			<td><?php echo $v['receipt_amount'];?></td>
			<td><?php echo $v['body'];?></td>
		</tr>
<?php
}
?>	
		<tr>
			<td colspan="9">
				<?php echo $obj->showPage("see_pay_info.php");?>
			</td>
		</tr>
	</table>
	
</div>
<!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
<script type="text/javascript" src="/public/js/jquery-3.3.1.min.js"></script>
<!-- 加载 Bootstrap 的所有 JavaScript 插件。你也可以根据需要只加载单个插件。 -->
<script type="text/javascript" src="/public/js/bootstrap.min.js"></script>
<!--<script type="text/javascript" src="work.js"></script>-->
</body>
</html>